package cn.edu.buu.news.mapper;

import cn.edu.buu.news.entity.User;
import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {
    //管理员登录
    void insert(User admin);
//    User selectAdmin(@Param("userName") String userName, @Param("password") String password);

    @Select("SELECT id, username, email, role, headPic FROM users WHERE username = #{userName} AND pwd = #{password}")
    User selectAdmin(@Param("userName") String userName, @Param("password") String password);

    // 根据ID更新用户头像
    int updateAvatar(@Param("id") Long id, @Param("avatarUrl") String avatarUrl);

    // 根据ID查询用户
    User selectById(Long id);

    // 根据用户名查询用户
    User selectByUsername(@Param("username") String username);

    // 根据ID更新用户信息
    int updateById(User user);


}